package model

type LeavingMessage struct {
	BaseModel
	UserID      int32  `gorm:"type:int;index"`
	MessageType int32  `gorm:"type:int comment '留言类型: 1(留言),2(投诉), 3(询问), 4(售后), 5(求购)'"`
	Subject     string `gorm:"type:varchar(100)"`
	Message     string // 如果string不写类型, 那默认是text类型, 不限制长度
	File        string `gorm:"type:varchar(200)"` // 文件上传到oss, 将URL存储
}

func (LeavingMessage) TableName() string {
	return "leavingmessage"
}

type Address struct {
	BaseModel
	UserID       int32  `gorm:"type:int;index"`
	Province     string `gorm:"type:varchar(10)"`
	City         string `gorm:"type:varchar(10)"`
	District     string `gorm:"type:varchar(20)"`
	Address      string `gorm:"type:varchar(100)"`
	SignerName   string `gorm:"type:varchar(20)"`
	SignerMobile string `gorm:"type:varchar(11)"`
}

// UserFav 用户收藏(需要设置联合唯一索引, 因为一个用户对一个商品只能收藏一次)
type UserFav struct {
	BaseModel
	UserID int32 `gorm:"type:int;index:idx_user_goods,unique"`
	Goods  int32 `gorm:"type:int;index:idx_user_goods,unique"`
}

func (UserFav) TableName() string {
	return "userfav"
}
